package com.dotmedia.entities;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Cascade;

/**
 * Entity implementation class for Entity: Permission
 * 
 */
@Entity
@Table(name = "permissions")
public class Permission implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "permissions_id_sequence")
	@SequenceGenerator(name = "permissions_id_sequence", sequenceName = "permissions_id_sequence", allocationSize = 1)
	@Column(name = "permission_id")
	private Integer id;

	@Column(name = "permission_ext_id", unique = true, nullable = false)
	private String permissionExtId;

	@Column(name = "description")
	private String description;

	@ManyToOne
	@JoinColumn(name = "permission_group_id", referencedColumnName = "permission_group_id")
	private PermissionGroup permissionGroup;

	@Column(name = "notes")
	private String notes;

	public Permission() {
	}

	public Permission(String permissionExtId, String description, String notes, PermissionGroup permissionGroup) {
		this.permissionExtId = permissionExtId;
		this.description = description;
		this.notes = notes;
		this.permissionGroup = permissionGroup;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getPermissionExtId() {
		return permissionExtId;
	}

	public void setPermissionExtId(String permissionExtId) {
		this.permissionExtId = permissionExtId;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public PermissionGroup getPermissionGroup() {
		return permissionGroup;
	}

	public void setPermissionGroup(PermissionGroup permissionGroup) {
		this.permissionGroup = permissionGroup;
	}
}
